<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${basePath}/css/register.css"/>
<link rel="stylesheet" type="text/css" href="${basePath}/css/user.css"/>
<link rel="stylesheet" type="text/css" href="${basePath}/css/form.css"/>
<script type="text/javascript">
	var contextPath = '${basePath}'; // 上下文 js 使用
</script>
<script type="text/javascript" src="${basePath}/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="${basePath}/js/jquery.validate-1.5.js"></script>
<script type="text/javascript" src="${basePath}/js/base.js"></script> 					<!-- 常用 js -->
<script type="text/javascript" src="${basePath}/js/core.js"></script> 	
<script type="text/javascript" src="${basePath}/js/pager.js"></script> 	
<script type="text/javascript" src="${basePath}/js/reg/person_register3.js"></script> 
<title>MSN人才网--个人会员注册</title>

<style type="text/css">
</style>


<script language="JavaScript">
 function form_check(){
  if (document.changpass.password.value==""){
  alert("请输入原密码！");
  document.changpass.password.focus();
  return false;
  }
  if(document.changpass.password.value.length<6){
	  alert("密码应该由6为以上的字符组成！");
	  document.changpass.password.focus();
	  return false;
 }
   if (document.changpass.password_new.value==""){
  alert("请输入新的密码！");
  document.changpass.password_new.focus();
  return false;
  }
   if (document.changpass.password_new.value.length<6){
  alert("密码应该由6为以上的字符组成！");
  document.changpass.password_new.focus();
  return false;
  }
  if (document.changpass.password_new.value!=document.changpass.password_new2.value){
  alert("确认密码必须与密码相同！");
  document.changpass.password_new2.focus();
  return false;
  } 

//提交修改密码
  //判断与原密码是否一至
  var  url="${basePath}/user/person!doMarkMD5.do?p1=1"+"&rmd="+Math.random();;
  var params={password:document.changpass.password.value};
  
  jQuery.post(url,params,function(data){
	
           if("yes"==$.trim(data)){

               var url_pass="${basePath}/user/person!doChangePass.do?p1=1"+"&rmd="+Math.random();;
               var params_pass={password:document.changpass.password_new.value};
               jQuery.post(url_pass,params_pass,function(result){
                     if("true"==$.trim(result)){
                    	 alert("修改成功！");
                    	 $(":password","#changpass").val('');
                    	 $('#up_passowd').hide();
                         }
                   });
                
               
             }else{
           alert("输入原密码有误。");
           document.changpass.password.value='';
            }
	  });
  
  
  
 }

 
 $(function(){
  $('#up_passowd').hide();
});
function show_chang_password(){
	$('#up_passowd').show();
}

 
</script>

<script type="text/javascript">
</script>
</head>
<body>
  <form action="${basePath}/user/person!doRegThree.do" method="post" name="changpass" id="changpass" >
                    <input type="hidden" name="username" value="${user.username }" /> 
                    <input type="hidden" name="passwordold" value="${user.password }" /> 
                    <input type="hidden" name="useremail" value="${user.useremail }" /> 
             

       
       
       <div class="right-content">
      <!--start by 个人帐号-->
      <div class="individual">
        <div class="individual_message">个人帐号</div>
        <div class="individual_message_2">
          <dl>
            <dt class="datum_1">用&nbsp;&nbsp;&nbsp;户&nbsp;名:&nbsp;</dt>
            <dd class="msg"> ${user.username }</dd>
          </dl>
          <div class="clear"></div><div class="buttom"></div>
          <dl>
            <dt class="datum_1">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;</dt>
            <dd class="msg"><a href="javascript:void(0);" onclick="show_chang_password()">修改密码</a></dd>
          </dl>
           <div class="clear"></div><div class="buttom"></div>
          <dl>
            <dt class="datum_1">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:&nbsp;</dt>
            <dd class="msg"> ${user.name }</dd>
          </dl>
           <div class="clear"></div><div class="buttom"></div>
          <dl>
            <dt class="datum_1">电子邮件:&nbsp;&nbsp;&nbsp;</dt>
            <dd class="msg">${user.useremail }</dd>
          </dl>
        </div>
       <div class="clear"></div><div class="buttom"></div>
       
         <div class="clear"></div>  <div class="clear"></div>
       <div id="up_passowd">
        <div class="individual_message">修改密码</div>
        <div class="individual_message_2">
        
        
        <dl>
        <dt class="datum_1">原密码：</dt> 
         <dd class="msg"><input  name="password" type="password"/></dd>
        </dl>
         <div class="clear"></div><div class="buttom"></div>
         <dl>
        <dt class="datum_1">新密码：</dt>
         <dd class="msg"> <input  name="password_new" type="password"/></dd>
        </dl>
         <div class="clear"></div><div class="buttom"></div>
         <dl>
        <dt class="datum_1">确认密码：</dt>  
         <dd class="msg"> <input  name="password_new2" type="password"/></dd>
        </dl>
    

    <input  name="btn_ok" type="button" value="修改" onclick="form_check()"/>
      </div>                    
      
      
        </div>
      </div>
      <!--end by 个人帐号-->
      <div class="clear"></div>
    </div>
   
</form>
</body>
</html>

